﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using ConstructionBidOnline.Biz;

public partial class Buyer_AddToArchive : System.Web.UI.Page
{

    #region Event Handlers

    #region Page Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["userid"] == null)
        {
            String strscript = "<script language=javascript>refreshandclose();</script>";
            if (!Page.IsStartupScriptRegistered("clientScript"))
                Page.RegisterStartupScript("clientScript", strscript);
        }

    }

    #endregion

    #region Button Yes Click

    protected void bttnselectyes_Click(object sender, ImageClickEventArgs e)
    {
        if (Session["userid"] == null)
        {
            String strscript = "<script language=javascript>refreshandclose();</script>";
            if (!Page.IsStartupScriptRegistered("clientScript"))
                Page.RegisterStartupScript("clientScript", strscript);
        }
        else
        {
            Job jobObj = Job.GetJobByID(Request.QueryString["JobID"].ToString());
            if (jobObj != null)
            {
                if (jobObj.IsArchieved == true)
                {
                    pnlfeedback.Visible = true;
                    lblfeedback.Text = "This Job is already Archived";
                }
                else
                {
                    jobObj.IsArchieved = true;
                    Job.Update(jobObj);


                    pnlfeedback.Visible = true;
                    lblfeedback.Text = "Job Archived Successfully";

                }
            }
        }
    }


    #endregion

    #region Button No Click

    protected void bttnselectno_Click(object sender, ImageClickEventArgs e)
    {
        String strscript = "<script language=javascript>refreshandclose();</script>";
        if (!Page.IsStartupScriptRegistered("clientScript"))
            Page.RegisterStartupScript("clientScript", strscript);
    }

    #endregion

    #endregion
}
